package com.zwz.control;

import com.zwz.bean.UserInfo;
import com.zwz.control.utils.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(("/user"))
public class LoginController {

    @PostMapping("/login")
    public Result userLogin(@RequestBody UserInfo userInfo){
        System.out.println(userInfo.getUsername());
        System.out.println(userInfo.getPassword());
        System.out.println(userInfo.getUsername().equals("admin"));
        System.out.println(userInfo.getPassword().equals("123456"));
        if (userInfo.getUsername().equals("admin") && userInfo.getPassword().equals("123456")) {
            return Result.success();
        }else {
            return Result.error();
        }

    }
}
